<template>
	<view>
		<u-card padding="1" v-for="(item,index) in dataList" :key="index">
			<view class="" slot="head">
				<view class="wrap">
					<u-row>
						<u-col span="12">
							<view class="weikaishi3 lanse">
								<span>[{{item.storeName}}]{{item.empName}}[{{item.plantDate}}]</span>
							</view>
						</u-col>
					</u-row>
					<u-row>
						<u-col span="12">
							<u-grid :col="3" >
								<u-grid-item  v-for="(item ,index1) in item.scheduleDetailInfo">
									<u-icon name="photo" :size="46" v-if="item.value == 1" style="background-color:greenyellow;" ></u-icon>
									<u-icon name="photo" :size="46" v-if="item.value != 1" style="background-color:red;" ></u-icon>
									<view class="grid-text">{{item.key}}</view>
								</u-grid-item>
							</u-grid>
							
						</u-col>
						
					</u-row>
					
					
				</view>
			</view>			
		</u-card>
			
		<view>
			<u-toast ref="uToast" />
		</view>
		
	</view>
</template>
<script>

	export default {
		data() {
			return {
				setMentiontime:'',
				dataList: [],
				dataList2: [],
				show:false,
				popupShow:false,
				areanumberlist:[],
				form:{
					id:''
				}
			}
		},
		onLoad(open) {
			//#ifdef H5 || APP-PLUS
			this.flex = 'u-flex'
			//#endif
			this.form.id = open.id
		},
		filters:{
			formatDate(value) {
			      if (!value) return ''; // 如果没有值，返回空字符串
			      const date = new Date(value); // 将日期字符串转换为 Date 对象
			      const year = date.getFullYear(); // 获取年份
			      const month = String(date.getMonth() + 1).padStart(2, '0'); // 获取月份，+1 是因为月份从 0 开始
			      const day = String(date.getDate()).padStart(2, '0'); // 获取日期
			      return `${year}-${month}-${day}`; // 返回格式化的日期字符串
			    }

		},
		onShow() {
			this.refresh()
		},
		onPullDownRefresh() {
			this.refresh()
			uni.stopPullDownRefresh()
		},
		methods: {
			clickCard(item){
				this.$Router.push({
					name: 'toDetailIndex'
				})
			},
			//门店排班
			toPb(){
				this.$Router.push({
					name: 'toPbIndex'
				})
			},
			//员工排班
			toEmpPlant(item){
				this.$Router.push({ 
					name: 'toEmpPlant',
					params: { 
						storeName:encodeURIComponent(item.storeName),
						plantDate:encodeURIComponent(item.plantDate)
					},
				})
			},
			yihedanmingxi(item){
				let storageOutNumbers = []
				for(let item1 of this.dataList) {
					if(item.getUnitId == item1.getUnitId && item.getLocationId == item1.getLocationId){
						for(let item2 of item1.list2) {
							if(item2.id == item.id){
								for(let item3 of item2.list2) {
									storageOutNumbers.push(item3.storageOutNumber)
								}
							}
						}
					}
				}
				this.$http.post('/rest/storageOut/apporderdetailslist?storageOutNumbers='+storageOutNumbers,{
				},{
					params: {
					},
					header: {
						'Authorization' :uni.getStorageSync('token'),
					}
				}).then(res => {
					this.dataList2 = res.data.data
					this.popupShow = true
				})
			},
			weihedanmingxi(storageOutNumber){
				let storageOutNumbers = []
				storageOutNumbers.push(storageOutNumber)
				this.$http.post('/rest/storageOut/apporderdetailslist?storageOutNumbers='+storageOutNumbers,{
				},{
					params: {
					},
					header: {
						'Authorization' :uni.getStorageSync('token'),
					}
				}).then(res => {
					this.dataList2 = res.data.data
					this.popupShow = true
				})
			},
			checkboxChange(e){
				console.log(e)
			},
			totaskss(item){
				let storageOutNumbers = []
				let privatecarCarnumbers = ''
				let areanumber = ''
				let getUnit = ''
				let getLocation = ''
				for(let item1 of this.dataList) {
					if(item.getUnitId == item1.getUnitId && item.getLocationId == item1.getLocationId){
						privatecarCarnumbers = item1.privatecarCarnumbers
						areanumber = item1.areanumber
						getUnit = item1.getUnit
						getLocation = item1.getLocation
						for(let item2 of item1.list2) {
							if(item2.id == item.id){
								for(let item3 of item2.list2) {
									storageOutNumbers.push(item3.storageOutNumber)
								}
							}
						}
					}
				}
				let storage_out_task = {}
				storage_out_task.storageOutNumber = storageOutNumbers
				storage_out_task.privatecarCarnumbers = privatecarCarnumbers
				storage_out_task.areanumber = areanumber
				storage_out_task.getUnit = getUnit
				storage_out_task.getLocation = getLocation
				uni.setStorageSync('storage_out_task', storage_out_task);
				this.$Router.push({ 
					name: 'storage_out_task_mark'
				})
			},
			totask(item){
				let storageOutNumbers = []
				let privatecarCarnumbers = ''
				let areanumber = ''
				let getUnit = ''
				let getLocation = ''
				storageOutNumbers.push(item.storageOutNumber)
				for(let item1 of this.dataList) {
					if(item.getUnitId == item1.getUnitId && item.getLocationId == item1.getLocationId){
						privatecarCarnumbers = item1.privatecarCarnumbers
						areanumber = item1.areanumber
						getUnit = item1.getUnit
						getLocation = item1.getLocation
					}
				}
				let storage_out_task = {}
				storage_out_task.storageOutNumber = storageOutNumbers
				storage_out_task.privatecarCarnumbers = privatecarCarnumbers
				storage_out_task.areanumber = areanumber
				storage_out_task.getUnit = getUnit
				storage_out_task.getLocation = getLocation
				uni.setStorageSync('storage_out_task', storage_out_task);
				this.$Router.push({ 
					name: 'storage_out_task'
				})
			},
			change(e) {
				this.setMentiontime = e.result
				this.refresh()
			},
			getT(){
				this.show = true
			},
			refresh(){
				uni.showLoading({
					title: '加载中...'
				})
				this.$http.post('/rest/pb/plantDetail1',{
				},{
					params: {
						id: this.form.id
					},
					header: {
						'Authorization' :uni.getStorageSync('token'),
					}
				}).then(res => {
					this.dataList = res.data.data
					uni.hideLoading()
				})
				
			},
		},
	}
</script>
<style lang="scss">
	.huanhang{
		word-break:break-all;
	}
</style>
<style scoped lang="scss">
	.grid-text {
		font-size: 28rpx;
		margin-top: 4rpx;
		color: $u-type-info;
	}
</style>